package com.rongshu.view.login.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

public class LoginQuestion implements Parcelable{

    /**
     * ErrCode : 0
     * ErrMsg :
     * Response : [{"id":1,"title":"为什么无法登陆?","content":"我怎么知道你为什么无法登陆","create_datetime":"2018-10-22 17:21:31","update_datetime":"2018-10-22 17:21:31","isvalid":true},{"id":2,"title":"为什么提示此手机号已绑定?","content":"我怎么知道你为什么手机号已绑定","create_datetime":"2018-10-22 17:21:31","update_datetime":"2018-10-22 17:21:31","isvalid":true},{"id":3,"title":"如何更换/解绑手机号？","content":"不知道","create_datetime":"2018-10-22 17:21:31","update_datetime":"2018-10-22 17:21:31","isvalid":true}]
     */

    private int ErrCode;
    private String ErrMsg;
    private List<ResponseBean> Response;

    protected LoginQuestion(Parcel in) {
        ErrCode = in.readInt();
        ErrMsg = in.readString();
        Response = in.createTypedArrayList(ResponseBean.CREATOR);
    }

    public static final Creator<LoginQuestion> CREATOR = new Creator<LoginQuestion>() {
        @Override
        public LoginQuestion createFromParcel(Parcel in) {
            return new LoginQuestion(in);
        }

        @Override
        public LoginQuestion[] newArray(int size) {
            return new LoginQuestion[size];
        }
    };

    public int getErrCode() {
        return ErrCode;
    }

    public void setErrCode(int ErrCode) {
        this.ErrCode = ErrCode;
    }

    public String getErrMsg() {
        return ErrMsg;
    }

    public void setErrMsg(String ErrMsg) {
        this.ErrMsg = ErrMsg;
    }

    public List<ResponseBean> getResponse() {
        return Response;
    }

    public void setResponse(List<ResponseBean> Response) {
        this.Response = Response;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(ErrCode);
        dest.writeString(ErrMsg);
        dest.writeTypedList(Response);
    }

    public static class ResponseBean implements Parcelable{
        /**
         * id : 1
         * title : 为什么无法登陆?
         * content : 我怎么知道你为什么无法登陆
         * create_datetime : 2018-10-22 17:21:31
         * update_datetime : 2018-10-22 17:21:31
         * isvalid : true
         */

        private int id;
        private String title;
        private String content;
        private String create_datetime;
        private String update_datetime;
        private boolean isvalid;

        protected ResponseBean(Parcel in) {
            id = in.readInt();
            title = in.readString();
            content = in.readString();
            create_datetime = in.readString();
            update_datetime = in.readString();
            isvalid = in.readByte() != 0;
        }

        public static final Creator<ResponseBean> CREATOR = new Creator<ResponseBean>() {
            @Override
            public ResponseBean createFromParcel(Parcel in) {
                return new ResponseBean(in);
            }

            @Override
            public ResponseBean[] newArray(int size) {
                return new ResponseBean[size];
            }
        };

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public String getCreate_datetime() {
            return create_datetime;
        }

        public void setCreate_datetime(String create_datetime) {
            this.create_datetime = create_datetime;
        }

        public String getUpdate_datetime() {
            return update_datetime;
        }

        public void setUpdate_datetime(String update_datetime) {
            this.update_datetime = update_datetime;
        }

        public boolean isIsvalid() {
            return isvalid;
        }

        public void setIsvalid(boolean isvalid) {
            this.isvalid = isvalid;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(id);
            dest.writeString(title);
            dest.writeString(content);
            dest.writeString(create_datetime);
            dest.writeString(update_datetime);
            dest.writeByte((byte) (isvalid ? 1 : 0));
        }
    }
}
